%% 算术运算
a = 3;
b = 1;
c = a + b;
a = 4;
b = 1;
c = a - b;
uint8_a = uint8(1);
uint8_b = uint8(5);
uint8_c = uint8_a + uint8_b;
uint16_a = uint16(50000);
% uint16_c = uint16_a + uint8_b; % error
uint16_c = uint16_a + uint16(uint8_b);
a = 2;
b = 3;
c = a * b;
a = 8;
b = 2;
c = a / b;
a = 8;
b = 3;
c = a / b;
uint8_a = uint8(8);
uint8_b = uint8(3);
uint8_c = uint8_a / uint8_b; % 执行结果为3，注意c语言执行结果是2
d = 2^4; % 乘方，结果为16。跟c语言运算不一样
uint8_d = rem(uint8_a, uint8_b); % 余数运算
uint8_e = mod(uint8_a, uint8_b); % 求模运算
rem_a = rem(8,-3); % 余数为2
mod_a = mod(8,-3); % 模数为-1
%% 关系运算
bool_a = 1 == 2; % bool_a结果为false，逻辑值0
bool_b = false == bool_a; % false等于false，所以bool_a等于true，逻辑值1
bool_c = 100 > 1; 
bool_d = 100 < 1; 
bool_e = 100 >= 1; 
bool_f = 100 <= 1; 
bool_g = 100 <= 100;
bool_h = 100 < 100; 
%% 逻辑运算
logical_a = true & true;
logical_b = true & false;
logical_c = false & false;
logical_d = true | true;
logical_e = true | false;
logical_f = false | false;
logical_g = ~true;
logical_h = ~false;
logical_i = (bool_a & bool_b) | bool_c;